// 年-月-日
function getDateStr(date) {
    var temp = new Date(date);
    var y = temp.getFullYear();
    var m = (temp.getMonth() + 1) + "";
    m = m.length > 1 ? m : "0" + m;
    var d = temp.getDate() + "";
    d = d.length > 1 ? d : "0" + d;

    return y + "-" + m + "-" + d;
}

// 格式化时间：年-月-日 时：分：秒
function getDateTimeStr(date) {
    var temp = new Date(date);
    var y = temp.getFullYear();
    var m = (temp.getMonth() + 1) + "";
    m = m.length > 1 ? m : "0" + m;
    var d = temp.getDate() + "";
    d = d.length > 1 ? d : "0" + d;
    var h = temp.getHours() + "";
    h = h.length > 1 ? h : "0" + h;
    var min = temp.getMinutes() + "";
    min = min.length > 1 ? min : "0" + min;
    var s = temp.getSeconds() + "";
    s = s.length > 1 ? s : "0" + s;

    return y + "-" + m + "-" + d + " " + h + ":" + min + ":" + s;
}